---
import HeadCommon from '../components/HeadCommon.astro';
import HeadSEO from '../components/HeadSEO.astro';
import Card from '../components/Card.astro';
import Header from '../components/Header/Header.astro';
import Footer from '../components/Footer.astro'
import { SITE } from '@/config';
import {sortPosts} from '@/util'

const posts = await Astro.glob('./posts/*.md');
const allPosts = sortPosts(posts);

---

<html lang="ch">
  <head>
    <HeadCommon />
    <HeadSEO pageURL={SITE.homePage} content={{}} />
    <title>{SITE.title}</title>
  </head>

  <body>
    <Header />

    <div class="mx-auto -mt-5 mb-12 xl:max-w-7xl w-full lg:max-w-5xl md:max-w-2xl max-w-xl md:box-border box-content md:px-0 px-3">
      <div class="grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2 mx-0 md:-mr-5 mr-0">
        {allPosts.map((p) => <Card post={p} />)}
      </div>
    </div>

    <Footer/>
    <script async src="https://tongji.linkroutes.com/script.js" data-website-id="032e98e9-7e16-4dc9-af0c-48b86a9ca6ae"></script>
  </body>
</html>
